<?php
namespace Plugin\Alarm\Schema;

use Plugin\Alarm\Model\RdAlarmBroadcastRecord;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 广播记录
 */
#[Schema(title: 'RdAlarmBroadcastRecordSchema')]
class RdAlarmBroadcastRecordSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '主键ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'file_id', title: '文件id', type: 'bigint')]
    public string $file_id;

    #[Property(property: 'second', title: '秒', type: 'decimal')]
    public string $second;

    #[Property(property: 'device', title: '广播id', type: 'json')]
    public array $device;

    #[Property(property: 'type', title: '类型 1:广播 2:喊话', type: 'int')]
    public string $type;

    #[Property(property: 'start_time', title: '开始时间', type: 'int')]
    public string $start_time;

    #[Property(property: 'end_time', title: '结束时间', type: 'int')]
    public string $end_time;

    #[Property(property: 'created_by', title: '创建者', type: 'int')]
    public string $created_by;

    #[Property(property: 'updated_by', title: '更新者', type: 'int')]
    public string $updated_by;

    #[Property(property: 'created_at', title: '创建时间', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: '更新时间', type: 'timestamp')]
    public string $updated_at;




    public function __construct(RdAlarmBroadcastRecord $model)
    {
       $this->id = $model->id;
       $this->file_id = $model->file_id;
       $this->second = $model->second;
       $this->device = $model->device;
       $this->type = $model->type;
       $this->start_time = $model->start_time;
       $this->end_time = $model->end_time;
       $this->created_by = $model->created_by;
       $this->updated_by = $model->updated_by;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return [
            'id' => $this->id,
            'file_id' => $this->file_id,
            'second' => $this->second,
            'device' => $this->device,
            'type' => $this->type,
            'start_time' => $this->start_time,
            'end_time' => $this->end_time,
            'created_by' => $this->created_by,
            'updated_by' => $this->updated_by,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at
        ];
    }
}